package certification.sections.session11.cap14;

import java.rmi.Naming;
import java.rmi.NotBoundException;
import java.rmi.RemoteException;

public class ServiceLocator {

	private static ServiceLocator instance = new ServiceLocator();
	private final String URL = "rmi://localhost";
	
	private ServiceLocator() {
	}
	
	public static ServiceLocator getInstance() {
		return instance;
	}
	
	public Object getObjectRemote(String jndi) throws Exception, RemoteException, NotBoundException {
		Object objRemote = Naming.lookup(URL + jndi);
		
		return objRemote;
		
	}
	
}
